package com.nervenets.general.i18n;

import org.springframework.context.i18n.LocaleContextHolder;

import java.util.Locale;

public final class LocaleResolver {
    public static Locale resolveLocale() {
        return useDefaultLocaleIfNecessary(LocaleContextHolder.getLocale());
    }

    protected static Locale useDefaultLocaleIfNecessary(Locale locale) {
        if (locale == null) {
            locale = new Locale("en");
        }
        return locale;
    }
}
